package com.lingz.manager.modules.wuxue.controller;


import com.lingz.manager.common.utils.ResultUtil;
import com.lingz.manager.common.vo.Result;
import com.lingz.manager.modules.wuxue.entity.WaterConservancyData;
import com.lingz.manager.modules.wuxue.entity.WaterDeviceInfo;
import com.lingz.manager.modules.wuxue.service.WaterConservancyDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (WaterConservancyData)表控制层
 *
 * @author makejava
 * @since 2023-12-08 14:40:59
 */
@Slf4j
@RestController
@Api(description = "水利设备监测数据管理接口")
@RequestMapping("/wuxue/waterConservancyData")
@Transactional
public class WaterConservancyDataController  {
    /**
     * 服务对象
     */
    @Resource
    private WaterConservancyDataService waterConservancyDataService;

    @GetMapping("/findWaterConservancyDataList")
    @ApiOperation("不分页查询水利监测数据")
    public Result<List<WaterConservancyData>> findWaterConservancyDataList() {
        return new ResultUtil<List<WaterConservancyData>>().setData(waterConservancyDataService.findWaterConservancyDataList());
    }

    @GetMapping("/findLatestDataById")
    @ApiOperation("获取最近5条监测数据")
    public Result<List<WaterConservancyData>> findLatestDataById(String id) {
        return new ResultUtil<List<WaterConservancyData>>().setData(waterConservancyDataService.findLatestDataById(id));
    }
}

